package com.zkingsoft.services.sys.impl;

import com.zkingsoft.services.sys.SysRolePwoerFnService;
import com.zkingsoft.pojo.PaginationVO;
import com.zkingsoft.model.sys.SysRolePwoerFn;
import com.zkingsoft.dao.sys.SysRolePwoerFnDao;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.zkingsoft.exception.GlobleException;
import com.zkingsoft.util.ModelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

/**
 * This field was generated by Zking.software.Codegen.
 * @date 2016-11-16 15:25
 */
@Service("sysRolePwoerFnService")
public class  SysRolePwoerFnServiceImpl implements    SysRolePwoerFnService  {

	
	@Autowired
	private SysRolePwoerFnDao sysRolePwoerFnDao;
	
	
	@Override
	public int add(SysRolePwoerFn sysRolePwoerFn){
		
		return sysRolePwoerFnDao.insert(sysRolePwoerFn);
		
	}
	
	@Override
	public int batchAdd(List<SysRolePwoerFn>  sysRolePwoerFnList) {
		return sysRolePwoerFnDao.batchInsert(sysRolePwoerFnList);
	}
	
	
   	
    @Override
	public int modifyByMap(SysRolePwoerFn oldSysRolePwoerFn
	,SysRolePwoerFn newSysRolePwoerFn){
	
		if (!ModelUtils.isModified(oldSysRolePwoerFn, newSysRolePwoerFn)) {
			return 1;
		}
		Map<String, Object> modifyMap=null;
		try {
			modifyMap = ModelUtils.comparePojo2Map(oldSysRolePwoerFn, newSysRolePwoerFn);
		} catch (Exception e) {
			throw 	new GlobleException("数据对比失败");
		}
		if (modifyMap.size() > 0) {
			modifyMap.put("rpfId", oldSysRolePwoerFn.getRpfId());
			sysRolePwoerFnDao.updateByMap(modifyMap);
		}
		return 1;
	}
	
	@Override
	public int modifyByModel(SysRolePwoerFn sysRolePwoerFn){
	
		return sysRolePwoerFnDao.updateByModel(sysRolePwoerFn);
	
	}
	
	
	
	@Override
	public int remove(List<Long> list){
	
		return sysRolePwoerFnDao.deleteByIds(list);
	
	}

	@Override
	public int removeById(Long rpfId){
	
		return sysRolePwoerFnDao.deleteById(rpfId);
	
	}
	
	@Override
	public int removeByModel(SysRolePwoerFn sysRolePwoerFn){
	
		return sysRolePwoerFnDao.deleteByModel(sysRolePwoerFn);
	
	}
	
	
	@Override
	public List<SysRolePwoerFn> findInPage(SysRolePwoerFn sysRolePwoerFn,  PaginationVO pageVo){
	
		return sysRolePwoerFnDao.selectInPage(sysRolePwoerFn , pageVo);
	
	}
	
	@Override
	public List<SysRolePwoerFn> findByModel(SysRolePwoerFn sysRolePwoerFn){
	
		return sysRolePwoerFnDao.selectByModel(sysRolePwoerFn);
	
	}
	
	@Override
	public int  findTotal(SysRolePwoerFn sysRolePwoerFn){
	
		return sysRolePwoerFnDao.selectTotalRecord(sysRolePwoerFn);
	
	}
	
	@Override
	public SysRolePwoerFn  findById(Long rpfId){
	
		return sysRolePwoerFnDao.selectById(rpfId);
	
	}

   	
	
	
}